{% extends "master.html" %}
{% block subtitle %} - 基础信息 - 商品管理{% endblock %}

{% block extJS %}
<script language="JavaScript" type="text/javascript">
//<![CDATA[
    function toSbumit(){
        $("#dataForm").submit();
        
    }
//]]>
</script>
{% endblock %}




{% block main %}
<div class="container">
    <div class="row">
        <ol class="breadcrumb">
          <li><a href="{{url_for('bpMas.view')}}">基础信息</a></li>
          <li class="active">商品管理</li>
        </ol>
    </div>
    
    <div class="row">
        <div class="panel panel-primary">
            <div class="panel-heading"><h4 class="panel-title">输入查询条件</h4></div>
            <div class="panel-body">
                <div class="row">{{mymacros.render_search_form(form,3)}}</div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="btn-toolbar pull-right">
                            <div class="btn-group"><button type="button" class="btn btn-default" onclick="$('.searchForm').submit()">{{BTN_SEARCH}}</button></div>
                            {% if getAllPermission(['PRODUCT_EDIT',])%}
                                <div class="btn-group"><button type="button" class="btn btn-default" onclick="return toSbumit()">批量修改</button></div>
                            {% endif %}
                            {% if getAllPermission(['PRODUCT_CREATE',])%}
                                <div class="btn-group"><a href="{{url_for('bpPdt.view',action='add')}}" class="btn btn-primary">创建商品</a></div>
                            {% endif %}
                        </div>
                    </div>
                </div>
            </div>

            <form method='post' action="{{url_for('.view',action='batchUpdate')}}" enctype="multipart/form-data" id="dataForm">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        {% if getAllPermission(['PRODUCT_EDIT',])%}
                            <td class="col-md-1"><input type="checkbox" onclick="selectall(this,'pdt')"/></td>
                        {% endif %}
                        <td class="col-md-3">商品编号</td>
                        <td>商品名称</td>
                        <td class="col-md-1">类型</td>
                        <td class="col-md-1">买价</td>
                        <td class="col-md-1">卖价</td>
                        <td class="col-md-2">经办人</td>
                        <td class="col-md-2">创建时间</td>
                    </tr>
                </thead>
                <tbody>
                    {% for r in result.items %}
                        <tr>
                            {% if getAllPermission(['PRODUCT_EDIT',])%}
                                <td><input type="checkbox" name="pdt" value="{{r.id}}"/></td> 
                            {% endif %}
                            <td>
                                {{mymacros.render_thumb(r, True)}}
                                <a href="{{url_for('bpPdt.view',action='view',id=r.id)}}">{{r.no}}</a>
                            </td>
                            <td>{{r.name}}</td>
                            <td>{{r.type|f}}</td>
                            <td>{{r.pPrice|f}}</td>
                            <td>{{r.sPrice|f}}</td>
                            <td>{{r.createBy|f}}</td>
                            <td>{{r.createTime|ft}}</td>
                        </tr>
                    {% endfor %}
                <tbody>
            </table>
            </form>
            {{mymacros.mypaginate(result)}}
        </div>
    </div>
</div>
{% endblock %}